package cn.hairui.blog.service.impl;

import cn.hairui.blog.model.Category;
import cn.hairui.blog.repository.CategoryRepository;
import cn.hairui.blog.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author lihairui
 * @version V1.0
 * @date: 2019/7/28 20:10
 */
@Service(value = "categoryService")
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryRepository categoryRepository;

    @Override
    public List<Category> findByIsShow(String isShow) {
        return categoryRepository.findByIsShow(isShow);
    }

    @Override
    public Category find(int categoryId) {
        return categoryRepository.find(categoryId);
    }

    @Override
    public List<Map> findCountList() {
        return categoryRepository.findCountList();
    }

    @Override
    public List<Category> list() {
        return categoryRepository.list();
    }

    @Override
    public List<Map> listMgr() {
        return categoryRepository.listMgr();
    }

    @Override
    public void updateIsShow(int id, String flag) {
        categoryRepository.updateIsShow(id, flag);
    }

    @Override
    public int add(Category category) {
        return categoryRepository.add(category);
    }

    @Override
    public int findMaxOrder() {
        return categoryRepository.findMaxOrder();
    }

    @Override
    public void delete(Category category) {
        categoryRepository.delelte(category);
    }

    @Override
    public void update(Category category) {
        categoryRepository.update(category);
    }

    @Override
    public void updateShowOrder(int id, int orderNo) {
        categoryRepository.updateShowOrder(id, orderNo);
    }
}
